package com.remon.quartz.service.impl;

import com.remon.quartz.dao.QuartzTriggersResp;
import com.remon.quartz.entity.QuartzTriggers;
import com.remon.quartz.service.QuartzTriggersService;
import com.remon.quartz.vo.PageRes;
import lombok.extern.java.Log;
import org.hibernate.criterion.Example;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 触发器逻辑处理类接口
 *
 * @author remon
 * @create 2018-09-08 22:26
 **/
@Service
@Log
public class QuartzTriggerServiceImpl extends BaseService implements QuartzTriggersService {

    /**
     * 触发器数据库处理对象
     */
    private final QuartzTriggersResp quartzTriggersResp;

    @Autowired
    public QuartzTriggerServiceImpl(QuartzTriggersResp quartzTriggersResp) {
        this.quartzTriggersResp = quartzTriggersResp;
    }


    /**
     * 获取数据库中的触发器
     *
     * @param pageNo   当前页
     * @param pageSize 每页条数
     * @param params   筛选参数
     * @return 返回分页对象 @link{PageRes}  @link{ QuartzTriggers }
     */
    @Override
    public PageRes<QuartzTriggers> pages(Integer pageNo, Integer pageSize, Map<String, Object> params) {
        return new PageRes<>(quartzTriggersResp.findAll(getPageable(pageNo, pageSize)));
    }
}
